﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using S_Userinfor.Domains;
using S_UserInfor.Read.Api.Application.Commands;

namespace S_UserInfor.Read.Api.Controllers
{
    /// <summary>
    /// SqlSuare 返回Token登录 登录控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class RegUserController : ControllerBase
    {
        private readonly IMediator _mediator;

        public RegUserController(IMediator mediator)
        {
            _mediator = mediator;
        }

        /// <summary>
        /// 登录方法 生成Token令牌
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<RegUserDataDTO> LoginDo(RegUserCommand command)
        {
            return await _mediator.Send(command);
        }
    }
}
